//
//  LeftHeaderView.m
//  Stop
//
//  Created by dllo on 16/3/5.
//  Copyright © 2016年 徐宏飞. All rights reserved.
//

#import "LeftHeaderView.h"

#define GAP 100

@implementation LeftHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubViews];
    }
    return self;
}


- (void)createSubViews{
    
    //背景
    UIImageView *imageV = [[UIImageView alloc] initWithFrame:self.bounds];
    imageV.image = [UIImage imageNamed:@"left_BG"];
    [self addSubview:imageV];
    
    //个人中心
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(100 + GAP, 30, 150, 50)];
    titleLabel.text = @"个人中心";
    titleLabel.textColor = [UIColor whiteColor];
    titleLabel.font = [UIFont systemFontOfSize:20];
    [self addSubview:titleLabel];
    
    //头像
    UIImageView *HeaderImageV = [[UIImageView alloc] initWithFrame:CGRectMake(100 + GAP, 90, 80, 80)];
    HeaderImageV.image = [UIImage imageNamed:@"left_BG"];
    [self addSubview:HeaderImageV];
    
    
    //退出按钮
    UIButton *exitBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    exitBtn.frame = CGRectMake(240 + GAP, 30, 60, 30);
    exitBtn.titleLabel.font = [UIFont systemFontOfSize:15];
    [exitBtn setTitle:@"注销" forState:UIControlStateNormal];
    [exitBtn addTarget:self action:@selector(exitBtnAction:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:exitBtn];
    
    //userLabel
    UILabel *userLabel = [[UILabel alloc] initWithFrame:CGRectMake(40 + GAP, 180, 200, 20)];
    userLabel.text = @"您好:1213456664";
    userLabel.font = [UIFont systemFontOfSize:15];
    [self addSubview:userLabel];
    
    //消息记录
    //退出按钮
    UIButton *msgBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    msgBtn.frame = CGRectMake(180 + GAP, 180, 60, 20);
    msgBtn.titleLabel.font = [UIFont systemFontOfSize:15];
    [msgBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [msgBtn setTitle:@"消息记录" forState:UIControlStateNormal];
    [msgBtn addTarget:self action:@selector(msgBtnAction:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:msgBtn];
    
  
    
}

- (void)msgBtnAction:(UIButton *)btn{
    NSLog(@"消息按钮点击");
}

- (void)exitBtnAction:(UIButton *)btn{
    NSLog(@"注销按钮点击");
}


@end
